home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / demo / bdemo / bdemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1991-08-27  |  54.1 KB  |  552 lines

  1. ButtonTest
  2. Picture-Button Demo
  3. wwwwwwwwwwwwwwp
  4. wwwwwwwwwwwwwp
  5. Form1*
  6. Picture1
  7. UUUUUUU
  8. UUUUUUUU
  9. UUUUUUUUP
  10. UUUUUUUU
  11. UUUUUUUUP
  12. UUUUUUUUU
  13. UUUUUUUUU
  14. UUUUUUUUP
  15. UUUUUUUUU
  16. UUUUUUUUU
  17. UUUUUUUUUP
  18. UUUUUUUUU
  19. UUUUUUUUUP
  20. UUUUUUUUUP
  21. UUUUUUUUU
  22. UUUUUUUUU
  23. wwwww
  24. UUUUUUUUUP
  25. UUUUUUUUUP
  26. wwwwwwwww
  27. UUUUUUUUU
  28. UUUUUUUUUP
  29. UUUUUUUUUU
  30. ppwpw
  31. UUUUUUUUU
  32. wwpppw
  33. fffffff`
  34. UUUUUUUUUP
  35. fffffffffff
  36. UUUUUUUUP
  37. fffffffffffffff
  38. UUUUUUUUU
  39. fffffffffffffffff
  40. UUUUUUUUU
  41. ffffffffffffffffffff
  42. UUUUUUUUP
  43. fffffffffffffffffffff`
  44. UUUUUUUUP
  45. ffffffffffffffffffffffff
  46. UUUUUUUU
  47. ffffffffffffffffffffffffff
  48. UUUUUUUU
  49. fffffffffffffffffffffffffff`w
  50. UUUUUUP
  51. fffffffffffffffffffffffffffff
  52. UUUUUUP
  53. fffffffffffffffffffffffffffffff
  54. UUUUUU
  55. ffffffffffffffffffffffffffffff`
  56. UUUUU
  57. ffffffffffffffffffffffffffffff
  58. UUUUP
  59. Ppwwwwpp
  60. 0fffffffffffffffffffffffffffffff
  61. ffffffffffffffffffffffffffffff`
  62. ffffffffffffffffffffffffffffff
  63. 0wwpfffffffffffffffffffffffffffffff
  64. ffffffffffffffffffffffffff
  65. ffffffffffffffffffffff`
  66. fffffffffffffffffff
  67. pffffffffffffffff`
  68. UUUPw
  69. wppwww
  70. ffffffffffffff
  71. pwwwww
  72. fffffffffff`
  73. UUUUP
  74. wwpffffffffff
  75. wwwwwww
  76. UUUUUP
  77. fffffff`
  78. UUUUUU
  79. fffff`
  80. UUUUUU
  81. UUUUUU
  82. UUUUUUU
  83. UUUUUUUP
  84. UUUUUUUUU
  85. pwwww
  86. UUUUUUUUUP
  87. UUUUUUUUUU
  88. UUUUUUUUUU
  89. wwwpwww
  90. UUUUUUUUUUPwp
  91. UUUUUUUUUUP
  92. wwwww
  93. UUUUUUUUUUU
  94. wwwww
  95. pUUUUUUUUUUUPwww
  96. UUUUUUUUUUUU
  97. ppwwwww
  98. UUUUUUUUUUUU
  99. UUUUUUUUUUUPpww
  100. pwwwpw
  101. UUUUUUUUUUUPp
  102. wpUUUUUUUUUUUU
  103. wwpwp
  104. ffffff`
  105. pwpppUUUUUUUUUUUU
  106. pwwpw
  107. fffffffff
  108. UUUUUUUUUUU
  109. wwppp
  110. wwwww
  111. ffffffffffff`
  112. UUUUUUUUUUUP
  113. pwpww
  114. wwwwwwp
  115. fffffffffffffff`
  116. UUUUUUUUUUUP
  117. ffffffffffffffffff
  118. pUUUUUUUUUUUU
  119. wpwww
  120. fffffffffffffffffffff`
  121. UUUUUUUUUUU
  122. wwpwp
  123. fffffffffffffffffffffffff`
  124. ppUUUUUUUUUUU
  125. pwwwww
  126. wwwww
  127. fffffffffffffffffffffffff
  128. pUUUUUUUUUUUP
  129. ffffffffffffffffffffffffff
  130. wpppw
  131. UUUUUUUUUUP
  132. ffffffffffffffffffffffffff`
  133. UUUUUUUUUUPpww
  134. wwwwww
  135. wwwww
  136. ffffffffffffffffffffffffff
  137. UUUUUUUUUUPppwpw
  138. fffffffffffffffffffffffffff
  139. UUUUUUUUUU
  140. ffffffffffffffffffffffffff`
  141. UUUUUUUUUU
  142. wwwww
  143. p`fffffffffffffffffffffffffff`ww
  144. UUUUUUUUU
  145. wpwwp
  146. fffffffffffffffffffffffffff
  147. UUUUUUUU
  148. wwwww
  149. fffffffffffffffffffffffffff`
  150. UUUUUUUPwwpp
  151. fffffffffffffffffffffffffff`
  152. UUUUUUUP
  153. wppwww
  154. ffffffffffffffffffffffffffff
  155. UUUUUPw
  156. ffffffffffffffffffff`
  157. ffffffffffffffffff
  158. pwwpwp
  159. wwwwp
  160. wwwww
  161. ffffffffffffffff`
  162. wwwww
  163. fffffffffffff`
  164. wwwwwww
  165. fffffffff
  166. pwpppp
  167. wwpwpwp
  168. wwwwp
  169. wwwwwww
  170. wwwwww
  171. wwwww
  172. wppwppp
  173. wwwww
  174. ppwpp
  175. wwwpwww
  176. wwwww
  177. wwwww
  178. wppwpp
  179. wpwppwwww
  180. ppwpppw
  181. wpwpw
  182. wpwwp
  183. wwwwp
  184. wwwpwwp
  185. ppwpppp
  186. sspwpw
  187. wppww
  188. wwwwwpwp
  189. spwww
  190. pwwww
  191. wwwww
  192. ppwww
  193. wwwwww
  194. wwwwwww
  195. pwwww
  196. pwppw
  197. pwwwp
  198. wwwwww
  199. wwwpwp
  200. 0pwpw
  201. wwwwww
  202. wpppw
  203. wwwwwp
  204. wwwwwww
  205. pppww
  206. pwwwwww
  207. wpwwwpw
  208. wwwppw
  209. wwwwwww
  210. pwwpppw
  211. wwwwpp
  212. ffffffffff`
  213. fffffffffff
  214. sspwp
  215. ffffffffff`
  216. pwwwp
  217. wwpwww
  218. pwwwwpwww
  219. fffffffffff`
  220. pppwpp
  221. wwwpwp
  222. ffffffffffff
  223. ppwwp
  224. pwwpw
  225. fffffffffff`
  226. ppwwww
  227. ffffffffffff
  228. 70ppp
  229. pwwwwp
  230. wwwww
  231. ffffffffffff
  232. ppppwwww
  233. `ffffffffffff`
  234. wpwww
  235. ffffffffffff
  236. pwwpw
  237. fffffffffffff
  238. pwpwww
  239. ffffffffffff`
  240. ppwwwp
  241. fffffffffffff
  242. ffffffffffff`
  243. ppppwpw
  244. wpwwpwpw
  245. wwwppwwwwwpwwp
  246. ffffffffffff`
  247. fffffffffff
  248. DDDDD
  249. wwwwwwww
  250. ffffffffff`
  251. ppwppww
  252. DDDDDDDDDDDDD@
  253. fffffff
  254. wppwpww
  255. DDDDDDDDDDDDDDDDDDDDD
  256. DDDDDDDDDDDDDDDDDDDD@
  257. wwwww
  258. DDDDDDDDDDDDDDDDDDD@
  259. ppwwwww
  260. DDDDDDDDDDDDDDDDDDD@
  261. pDDDDDDDDDDDDDDDDDDD@
  262. DDDDDDDDDDDDDDDDDD@
  263. wwwwwpDDDDDDDDDDDDDDDDDD@
  264. wwwww
  265. DDDDDDDDDDDDDDD
  266. ppwpwp
  267. wpwww
  268. DDDDDDDD@wpww
  269. pwppw
  270. wpwpwp
  271. wwwwww
  272. wpwww
  273. pppwp
  274. ppwww
  275. wwwwwp
  276. wwwww
  277. wwwwpw
  278. wwppp
  279. wwwwpw
  280. wpwwpw
  281. DDDDD@
  282. pwwww
  283. DDDDDDDDDDDD
  284. DDDDDDDDDDDDDDD
  285. 70DDDDDDDDDDDDDD@
  286. DDDDDDDDDDDDD
  287. 0DDDDDDDDDDDD@
  288. pwwpwp
  289. pppwp
  290. DDDDDDDDDDD@
  291. pwwww
  292. ppwwpp
  293. DDDDDDDDDD@
  294. ppwww
  295. pwppw
  296. wwpwwwpw
  297. DDDD@
  298. pDDDDDDDDDD@
  299. wwwpw
  300. wwwwww
  301. wpwww
  302. DDDDDD
  303. DDDDDDDDD@
  304. DDDDDDD
  305. DDDDDDDDD
  306. wwwpw
  307. DDDDDDD@
  308. 0DDDDDDDD
  309. pppwpw
  310. pwwppwpw
  311. DDDDDDDD@
  312. DDDDDDD@
  313. wwpwppp
  314. DDDDDDDD
  315. DDDDDDDD
  316. DDDDDDD
  317. DDDDDDD
  318. DDDDDDDDDDDDDD@
  319. wwppw
  320. DDDDDDDDDDDDD
  321. DDDDDDDDDD@
  322. DDDDDDD
  323. wwpwww
  324. DDDDD
  325. wwpwwp
  326. pwppw
  327. pwwwp
  328. wpppw
  329. ppppw
  330. pppww
  331. pwwww
  332. pwppww
  333. wwppw
  334. wwpwpww
  335. pwppp
  336. pwwwp
  337. pppwwpwpww
  338. pwwppww
  339. pppwp
  340. wpwwww
  341. wwwwp
  342. wppppppw
  343. pwwwpwwpwww
  344. pwpwpp
  345. pwwwpw
  346. wwwww
  347. wwpppp
  348. wpwpp
  349. wppppw
  350. wwwwww
  351. wwwww
  352. wpwwp
  353. ppwpww
  354. wpwpwwwwww
  355. wwwppwwww
  356. wpwww
  357. pppwpwpwpppwwww
  358. wpwwppp
  359. pwppwwwwww
  360. wwppww
  361. DDDDDDDDDDD
  362. DDDDDDDDDDDDDDDDDD
  363. DDDDDDDDDDDDDDDDDDD@
  364. DDDDDDDDDDDDDDDDDD@
  365. DDDDDDDDDDDDDDDDDD@
  366. DDDDDDDDDDDDDDDDDDD
  367. UUUUP
  368. DDDDDDDDDDDDDDDDDDD
  369. DDDDDDDDDDDDDDDDDDD
  370. UUUUU
  371. DDDDDDDDDDDDDDDDDD@
  372. UUUUUU
  373. DDDDDDDDDDD
  374. UUUUUUP
  375. UUUUUU
  376. UUUUUUU
  377. UUUUUUP
  378. UUUUUUU
  379. ButtonStrip
  380. PushButton
  381. ButtonPict
  382. DDD@w
  383. PushButton
  384. ButtonPict
  385. """'p
  386. PushButton
  387. ButtonPict
  388. PushButton
  389. ButtonPict
  390. PushButton
  391. ButtonPict
  392. 3338333
  393. 33338
  394.     PictureDN
  395. tDHDD
  396.     PictureUP
  397. DDD@w
  398. NumButtons
  399. ButtPictTop
  400. ButtPictLeft
  401. @    Form_Load
  402. ButtonPict{
  403. LeftH
  404. ButtonUP
  405. PictureUP_MouseDown
  406. ButtonL
  407. Shift
  408.     PictureDN
  409. VisibleX
  410.     PictureUP
  411. picture1
  412. CurrentXe
  413. CurrentY
  414. PictureUP_MouseUp0
  415. ButtonDown
  416. PushButton
  417.     DrawWidth^
  418. ScaleWidth
  419. ScaleHeight
  420. PushButton_MouseDown
  421. index
  422. PushButton_MouseUp
  423. Picture1_MouseDown
  424. Picture1_MouseUp
  425. ButtonPict_MouseDown
  426. ButtonPict_MouseUpm
  427. placed
  428. The main procedures in this program are the generall
  429. procedures ButtonUp and ButtonDown. Form_Load initializess
  430. the buttons in the up position and stores the locationss
  431. of their pictures.
  432. To use these procedures in your program:
  433.    1.  Create a picture box control with the CtlName set
  434.  to "PushButton"
  435.    2.  Create a picture box control on top of the PushButttonn
  436.  picture box and set the CtlName to "ButtonPict".i
  437.    3.  Copy both picture boxes by selecting the PushButton
  438.  picture box and executing the "Edit-Copy" command.m
  439.    4.  Paste a copy for each button you want to create and
  440.  create the control arrays PushButton() and ButtonPict().c
  441.  These procedures were obviously designed to control
  442.  more than one button. You can, however, modify them
  443.  if you need only one simulated button.t
  444.    6.  Adjust the buttons to the sizes you want. Although thee
  445.  routines should work with any size buttons, there isr
  446.  a practical limit because of the time it takes for VB
  447.  to draw the lines on them.t
  448.    5.  Load your pictures (icon, bmp, etc) into the picturee
  449.  boxes on top of your buttons (ButtonPict()), size and
  450.  position them as necessary.  
  451.    6.  Copy the subs ButtonUp and ButtonDown into the.
  452.  (general) (declarations) section for your form and thed
  453.  initializing routine into your Form_Load procedure.
  454.    7.  Put a CALL to ButtonDown in your PushButton_MouseDown and
  455.  ButtonPict_MouseDown event procedures. Likewise, put callsc
  456.  to ButtonUp in your PushButton_MouseUp and ButtonPict_P
  457.  MouseUp event procedures. t
  458.    8.  Copy the declarations below into your program and changee
  459.  the value of NumButtons% to the number of simulated
  460.  buttons on your form.
  461. That is all there is to it. See the comments in ButtonUp and
  462. ButtonDown for more information.
  463. The camera button (the camera that is a button) is handled differently.
  464. it is simply two separate pictures (not an array). The picture
  465. that represents the object in the up position is called PictureUp andd
  466. is placed over the other (PictureDn). Your code only needs too
  467. handle the MouseUp and MouseDown events for the top picture, since
  468. the user cannot access the bottom picture. In your mouse event
  469. handlers, you just have to switch visibility between the two pictures.
  470. You could, of course, do all of your buttons this way by makingg
  471. two control arrays for the pictures, just like the other buttons,,
  472. but this method requires a little more manual work, because you have
  473. to create both up and down representations of each picture. The camera
  474. was first drawn (using Iconwrks) in the up position with shadows on the
  475. right and bottom. Then the icon was copied and pasted into another
  476. icon - offset one pixel to the right and one pixel down from the original.
  477. The shadow was removed from the right and bottom and shadow was addedd
  478. to the top and left. You can load both icons into Icon Works to seee
  479. what I mean.
  480. Change the Constant NumButtons% to the actual number of simulateds
  481. buttons on your form. 
  482. used to pass the index to the general procedures
  483. These are used for
  484.    coordinates when
  485.    moving the pictures
  486.    on the buttons.
  487. These will store the locations
  488.    of the button pictures when
  489.    the form is loaded.  
  490. Form_Load
  491. Display all the buttons-
  492. in the up position.l
  493. PictureUP_MouseDown
  494. *** This handles the camera that is not on a button ***i
  495. **  Process code here - just like a command_MouseDown **
  496. **  event. Or you could put your code in the MouseUP  **
  497. **  procedure to make it look like a Command_Click.   **
  498. You're holding the camera down."u
  499. PictureUP_MouseUp
  500. ** This procedure handles the camera that is not on **
  501. ** a button.
  502. ( ** 
  503. **  Process code here - just like a command button  **
  504. ButtonDown
  505. This procedure draws the button in the down position..
  506. Remember ScaleMode must be set to 3 (pixels) on PushButton()
  507. for this to work properly.
  508. Set line width to one pixelt
  509. *** First draw a black box around the button
  510. *** Next erase the white and dark inside lines and
  511. *** change the white outside lines to dark grey.
  512. *** Move the picture down and right 1 pixel
  513.  *** 
  514. ** The following code puts the demo text on the picture. **A
  515. ** You could process your button commands here or in the **A
  516. ** ButtonUP procedure.  Processing in the ButtonUP pro-  **A
  517. ** cedure would act like a Command_Click event.
  518. ix is the button index
  519. Camera
  520. Apple"
  521. Folder
  522.  Button"
  523. ButtonUP
  524. *** Draw 2 white lines accross the top of the button. ****
  525. *** The second is 1 pixel shorter than the first.
  526.  ****
  527. ***  Draw 2 dark lines on the left side of the button. **
  528. ***  The second is 2 pixels shorter than the first.
  529. *** Draw 2 white lines down the left side of the button *
  530. *** The second is 2 pixels shorter than the first.
  531. *** Draw 2 dark lines at the bottom of the button.
  532. *** The second is 2 pixels longer than the first.
  533.  ****
  534. *** Move the picture up and left 1 pixel
  535. **  You could put your button processing code here   **-
  536. **  to look like a Command_Click event.
  537. For this demo just erase the text*
  538. on the picture.o
  539. PushButton_MouseDown
  540. PushButton_MouseUp
  541. Picture1_MouseDown
  542. This picture is just for decoration.u
  543. Picture1_MouseUp
  544. ButtonPict_MouseDown
  545. *** This is necessary in case someone presses the mouse ***
  546. *** button while the pointer is over the picture on the ***
  547. *** button instead of the button itself.
  548. ButtonPict_MouseUp
  549. *** This is necessary in case someone pressed the mouse ***
  550. *** button while the pointer was over the picture on
  551. *** the button instead of the button itself.
  552.